Public Class frmMain

  Private Sub cmdProceed_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdProceed.Click

    If optNewStruc.Checked = True Then
      frmStructureGenerator.Show()

    ElseIf optModifyStruc.Checked = True Then
      'Nothing as yet

    ElseIf optViewStruc.Checked = True Then
      'Nothing as yet

    ElseIf optGenStrucCode.Checked = True Then

      If Trim(cboMainClassName.Text) = "" Then
        MsgBox("Please Select the Main Class Name")
      Else
        Call SubGenerateCode(Trim(cboMainClassID.Text))
      End If

    ElseIf optGlblConst.Checked = True Then

      Dim objGnrtConstMod As New clsGnrtConstMods
      mPrRefreshConn()
      objGnrtConstMod.CreateConstantsFile()
      MsgBox("Global Constants File Generated.")
      DBDisconnect()
    End If

    cboMainClassCatg.SelectedIndex = 0
    cboMainClassID.SelectedIndex = 0
    cboMainClassName.SelectedIndex = 0
    lblMessage.Text = ""

  End Sub

  Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Dim objMcls As New clsMainclass

    mPrRefreshConn()
    objMcls.fnSelectAllMcls()

    While objMcls.mDrMainClass.Read

      cboMainClassID.Items.Add(objMcls.mDrMainClass("MCLS_IDXX").ToString)
      cboMainClassName.Items.Add(objMcls.mDrMainClass("MCLS_NAME").ToString)
      cboMainClassCatg.Items.Add(objMcls.mDrMainClass("MCLS_CATG").ToString)

    End While

    cboMainClassCatg.SelectedIndex = 0
    cboMainClassID.SelectedIndex = 0
    cboMainClassName.SelectedIndex = 0

    DBDisconnect()
    optNewStruc.Checked = True

    cboMainClassName.Visible = False

  End Sub

   
  Private Sub optModifyStruc_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optModifyStruc.CheckedChanged

    lblMessage.Text = "Coding for this feature is still in progress"
    cboMainClassName.Location = New System.Drawing.Point(295, 57)
    cboMainClassName.Enabled = False
    cboMainClassName.Visible = True
    cmdProceed.Enabled = False

  End Sub

  Private Sub optViewStruc_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optViewStruc.CheckedChanged

    lblMessage.Text = "Coding for this feature is still in progress"
    cboMainClassName.Location = New System.Drawing.Point(295, 92)
    cboMainClassName.Enabled = False
    cboMainClassName.Visible = True
    cmdProceed.Enabled = False

  End Sub

  Private Sub optGenStrucCode_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optGenStrucCode.CheckedChanged

    lblMessage.Text = "Select the name of the main class"
    cboMainClassName.Location = New System.Drawing.Point(295, 131)
    cboMainClassName.Enabled = True
    cboMainClassName.Visible = True
    cmdProceed.Enabled = True

  End Sub
  Private Sub SubGenerateCode(ByVal iMainClassID As Integer)
    Dim objGnrtStruct As New clsGnrtStruct

    mPrRefreshConn()

    objGnrtStruct.mIntMainClassId = iMainClassID
    objGnrtStruct.GenerateStructure()

    MsgBox("The Class File generated as C:\cls" + cboMainClassName.Text + ".vb", MsgBoxStyle.Information, gCONST_MSG_HEADER)

    'Call code to generate the Code for the class created by passing the main class id as input

    If cboMainClassCatg.Text = "FIXX" Then
      gfnCodeGenerator(iMainClassID)
      MsgBox("The Class Code generated as C:\cls" + cboMainClassName.Text + "Packet.vb", MsgBoxStyle.Information, gCONST_MSG_HEADER)
    End If

    DBDisconnect()

    Me.Cursor = Cursors.Default
  End Sub

  Private Sub cboMainClassName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboMainClassName.SelectedIndexChanged
    cboMainClassID.SelectedIndex = cboMainClassName.SelectedIndex
    cboMainClassCatg.SelectedIndex = cboMainClassName.SelectedIndex
  End Sub

  Private Sub optNewStruc_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optNewStruc.CheckedChanged
    lblMessage.Text = "Click Proceed to Continue"
    cmdProceed.Enabled = True
  End Sub

   
  Private Sub optGlblConst_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optGlblConst.CheckedChanged
    lblMessage.Text = "Click Proceed to Continue"
    cboMainClassName.Enabled = False
    cboMainClassName.Visible = False
    cmdProceed.Enabled = True
  End Sub
End Class